#! /usr/bin/env python
# -*- coding: utf-8 -*-

# *************************************************************
#     Filename @  exponential_wait.py
#       Author @  Huoty
#  Create date @  2016-04-22 16:43:37
#  Description @  
# *************************************************************

from retrying import retry

@retry(stop_max_attempt_number=4, wait_exponential_multiplier=1000)
def wait_exponential_1000():
    print "Wait 2^x * 1000 milliseconds between each retry, up to 10 seconds, then 10 seconds afterwards"
    try:
        raise Exception("Retry!")
    except Exception:
        pass

# Script starts from here

if __name__ == "__main__":
    wait_exponential_1000()
